//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
/*********************************************************************
Copyright:      (c) Intel Corporation, 2002, 2003
 
INTEL MAKES NO WARRANTY OF ANY KIND REGARDING THE CODE.  THIS CODE IS
LICENSED ON AN "AS IS" BASIS AND INTEL WILL NOT PROVIDE ANY SUPPORT,
ASSISTANCE, INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL DOES NOT
PROVIDE ANY UPDATES ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY
DISCLAIMS ANY WARRANTY OF MERCHANTABILITY, NONINFRINGEMENT, FITNESS
FOR ANY PARTICULAR PURPOSE, OR ANY OTHER WARRANTY.  INTEL DISCLAIMS
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGMENT OF ANY PROPRIETARY
RIGHTS, RELATING TO USE OF THE CODE.  NO LICENSE, EXPRESS OR IMPLIED,
BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS
GRANTED HEREIN.
*********************************************************************/



// Bulverde configuration register values
#define BV_LCCR0_VAL_VGA  	0x01B008F9   // * LCD Controller Control register 0  
#define BV_LCCR0_VAL_QVGA  	0x01B008F9   // * LCD Controller Control register 0  

#define BV_LCCR0_VAL_QVGA_CPU  	0x01F008F9   // * LCD Controller Control register 0  

#define BV_LCCR1_VAL_VGA  	0x015FFE7F   // * LCD Controller Control register 1  (for Toshiba VGA)
#define BV_LCCR1_VAL_QVGA  	0x03070CEF   // * LCD Controller Control register 1 (for Toshiba QVGA) 

#define BV_LCCR2_VAL_VGA  	0x022B01DF   // * LCD Controller Control register 2  (for Toshiba VGA)
#define BV_LCCR2_VAL_QVGA 	0x0303053F   // * LCD Controller Control register 2 (for Toshiba QVGA)

#define BV_LCCR3_VAL_VGA  	0x03700002   // * LCD Controller Control register 3  
//#define BV_LCCR3_VAL_QVGA  	0x0370000b   // * LCD Controller Control register 3   pclk = 11 = 4.33MHz
#define BV_LCCR3_VAL_QVGA  	0x0370000f   // * LCD Controller Control register 3   pclk = 11 = 4.33MHz



#define FONT_9x16
//#define FONT_16x32		// 8/6/03 this option has not been tested

//==> Switch between VGA and QVGA here --
//#define VGA_Landscape	  	
#define QVGA_Portrait							


#ifdef QVGA_Portrait				
#define LCD_WIDTH       	240	
#define LCD_HEIGHT      	320
#endif

#ifdef VGA_Landscape				
#define LCD_WIDTH 	   		640
#define LCD_HEIGHT  	   	480
#endif


#ifdef FONT_16x32				
#define LCD_CHAR_HEIGHT    32
#define LCD_CHAR_WIDTH      16
#define LCD_CHAR_Y_OFFSET   1
#define LCD_CHAR_X_OFFSET   1
#endif


#ifdef FONT_9x16				
#define LCD_CHAR_HEIGHT    16
#define LCD_CHAR_WIDTH      8
#define LCD_CHAR_Y_OFFSET   1
#define LCD_CHAR_X_OFFSET   1
#endif


// Shouldn't have to mess with this
#define LCD_CHAR_ROW_HEIGHT     (LCD_CHAR_HEIGHT + (LCD_CHAR_Y_OFFSET*2))
#define LCD_CHAR_ROW_MAX        ((int)(LCD_HEIGHT/LCD_CHAR_ROW_HEIGHT))
#define LCD_CHAR_COL_WIDTH      (LCD_CHAR_WIDTH + (LCD_CHAR_X_OFFSET*2))
#define LCD_CHAR_COL_MAX        ((int)(LCD_WIDTH/LCD_CHAR_COL_WIDTH))


#define LCD_PALETTE_SIZE	256


struct FrameBuffer_8bit {
  unsigned short palette [256];
  unsigned char  pixel[LCD_HEIGHT][LCD_WIDTH];
  unsigned int nCharPosX;        // current row of place to put new character
  unsigned int nCharPosY;        // current col "
};

struct FrameBuffer_12bit {
  unsigned short dummy_data [16];
  unsigned short pixel[LCD_HEIGHT][LCD_WIDTH];
};

struct FrameBuffer_16bit {
  unsigned short  pixel[LCD_HEIGHT][LCD_WIDTH];
  unsigned int nCharPosX;        // current row of place to put new character
  unsigned int nCharPosY;        // current col "
};

struct FrameBuffer_18UnPackbit {
  unsigned int pixel[LCD_HEIGHT][LCD_WIDTH];
  unsigned int nCharPosX;        // current row of place to put new character
  unsigned int nCharPosY;        // current col "
};

struct FrameBuffer_16UnPackbit {
  unsigned short pixel[LCD_HEIGHT][LCD_WIDTH];
  unsigned int nCharPosX;        // current row of place to put new character
  unsigned int nCharPosY;        // current col "
};

struct FrameCommand_Buffer
{
     unsigned short  commandList[16];
};

struct _LCD_Descriptor {
	unsigned int FDADR;				// frame descriptor address
	unsigned int FSADR;				// frame start address
	unsigned int FIDR;					// frame id reg
	unsigned int LDCMD;				// LCD command reg
};

